<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Attr extends Model
{
    protected $fillable = ['index', 'input_type', 'type_id', 'name', 'values', 'order'];

    protected $casts = [
        'values' => 'array',
        'index'  => 'boolean'
    ];

    public function type()
    {
        return $this->belongsTo('App\Type');
    }

    public function goods()
    {
        return $this->belongsToMany('App\Attr');
    }
}
